package testview.zhen.com.myapplication.hencoder.practice_draw1

import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
import android.util.AttributeSet
import android.view.View

class Practice3DrawRectView : View {

    var paint = Paint()
    constructor(context: Context) : super(context) {}

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}

    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {}

    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)

        paint.style= Paint.Style.FILL
        var f = RectF(100.0f,0.0f,(canvas.width-100).toFloat(),canvas.height.toFloat())
        canvas.drawRect(f,paint)
        //        练习内容：使用 canvas.drawRect() 方法画矩形
    }
}
